import { defineStore } from "pinia";

interface Person {
  id: number;
  name: string;
}

interface PersonsState {
  persons: Person[];
}

export const useCounterStore = defineStore("persons", {
  // state: (): PersonsState => {
  //   return {
  //     persons: [],
  //   };
  // },
  state(): PersonsState {
    return {
      persons: [],
    };
  },
  actions: {
    getPersonList() {
      setTimeout(() => {
        this.persons = [{ id: 1, name: "静哥" }];
      }, 1000);
    },
  },
});
